﻿<?php
/*
 * @Package Softpin Order Manager
 * @Subpackage : sim Manager
 * Create by : thuc.lehuy@gmail.com
 */
jimport('joomla.html.toolbar');
defined('_JEXEC') or die('Restricted access');
if(!$this->items){
    echo '<div class="componentheading"><div>Kết quả tìm kiếm : Không có Sim được tìm thấy</div></div><div><a href="datsim.html" style="color:red;padding-left:10px">Hiện tại không có sim theo yêu cầu của bạn,mời bạn đặt sim với chúng tôi bằng chức năng đặt sim!</a></div>';
}else{

$ish = JRequest::getVar("s2s");
$Textsim = JRequest::getVar("Textsim");
$c=0;
if( isset($Textsim) && $Textsim != "") {

if( isset($ish) && $ish == "1") $c =1;

}





?>
<div  class="div_sim">
    <div class="componentheading"><div>Kết quả: Có tổng cộng <b style=""><?php echo $this->pagination->total;?></b> sim.<?php echo $this->pagination->getPagesCounter(); ?></div></div>
    <table width="100%" cellspacing="1" cellpadding="5" border="0">
        <thead>
            <tr class="tr_header_sim">
                <th nowrap="nowrap" width="5%">
                    <?php echo JText::_( 'ID' ); ?>
                </th>
                <th nowrap="nowrap" width="25%">
                    <?php echo JText::_( 'Số sim' ); ?>
                </th>
                <th nowrap="nowrap" width="15%">
                    <?php echo JText::_( 'Mạng' ); ?>
                </th>
                <th nowrap="nowrap" width="30%">
                    <?php echo JText::_( 'Giá' ); ?>
                </th>
				<!--
                <th nowrap="nowrap" width="20%">
                    <?php //echo JText::_( 'Kho admin' ); ?>
                </th>
				-->
                <th nowrap="nowrap" width="20%">
                   Đặt Nhanh
                </th>
            </tr>
        </thead>
        <?php
        $k = 1;
		$n=count( $this->items );
        for ($i=0;$i < $n; $i++)
        {
            $row =& $this->items[$i];
            //$checked 	= JHTML::_('grid.id',   $i, $row->sim_id );
            $link 		= JRoute::_( 'index.php?option=com_simbuy&task=add&simnumb='.$row->sim_numb );
            ?>
        <tr class="tr_sim">
            <td>
                <?php echo $k+($this->currenPage *30); ?>
            </td>
            <td>
                <?php JHTML::_('behavior.modal'); ?>
                <a  href="<?php JURI::root()?>index.php?option=com_simbuy&task=simorder&num=<?php echo $row->sim_numb; ?>">
				<?php 
				
				if($c){ 
				
					echo str_replace($Textsim,"<font class='heightline_r'>".$Textsim."</font>",$row->sim_numb); 
				}
				else {
				
					echo $row->sim_numb;
				}
				?>
				
				</a>
            </td>
            <td align="left" style="padding-left: 10px;">
                <?php 
					switch(trim(strip_tags($row->provider_name)))
					{
						case "Viettel": 
							echo "<img alt='sim so dep Viettel' src='./images/sim/log_viettel.jpg' />";
							break;		
						case "MobiFone": 
							echo "<img alt='sim so dep MobiFone' src='./images/sim/logo_mobifone.jpg' />";
							break;
						case "VinaFone": 
							echo "<img alt='sim so dep Vinafone' src='./images/sim/logo_vinaphone.jpg' />";
							break;
						case "Vietnam Mobile":
							echo "<img src='./images/sim/logo-vietnam_mobile.jpg' />";
							break;	
						default: 
							echo $row->provider_name;
							break;
					}	
				?>
			</td>
            <td>
                <?php echo $row->price; ?>.000 <?php echo $row->curency; ?>
            </td>
            <!--<td>
                <?php //echo $row->admin_name; ?>
            </td>-->
            <td>
                <?php JHTML::_('behavior.modal'); ?>
                <?php JHTML::_('behavior.modal'); ?>
                <a rel="{handler: 'iframe', size: {x: 600, y: 400}}" href="<?php echo $link; ?>" class="modal btn">Đặt Sim</a>
            </td>
        </tr>
        <?php
        $k =$k+1;
    }
    ?>
	<tfoot>
		<tr>
			<td align="center" colspan="16">
				<?php
					 echo $this->pagination->getPagesLinks();
				?>
			</td>
		</tr>
	</tfoot>
    </table>
    <input type="hidden" name="option" value="com_sim" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="controller" value="sim" />
</div>
<?php }?>